package com.athena.dal.entities;

import java.io.Serializable;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * The persistent class for the routine database table.
 * 
 */
@Entity
@Table(name = "routine_instance")
public class RoutineInstance implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(unique = true, nullable = false)
	private int id;

	@Column(nullable = false)
	private long yearOfDay;

	@Column(nullable = false)
	private Time startTime;

	@Column(nullable = false)
	private Time endTime;

	@ManyToOne
	@JoinColumn(name = "facultyId", nullable = false)
	private Faculty faculty;

	// bi-directional many-to-one association to LearningPlace
	@ManyToOne
	@JoinColumn(name = "classId", nullable = false)
	private Class clazz;

	@ManyToOne
	@JoinColumn(name = "subjectId", nullable = false)
	private Subject subject;

	// bi-directional many-to-one association to LearningPlace
	@ManyToOne
	@JoinColumn(name = "learningPlaceId", nullable = false)
	private LearningPlace learningPlace;
	
	@Column(nullable = false)
	private Timestamp updatedAt;
	
	@OneToMany(mappedBy="routineInstance")
	private Set<Attendance> attendance;

	public RoutineInstance() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public long getYearOfDay() {
		return yearOfDay;
	}

	public void setYearOfDay(long yearOfDay) {
		this.yearOfDay = yearOfDay;
	}

	public Time getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Time endTime) {
		this.endTime = endTime;
	}

	
	public Time getStartTime() {
		return this.startTime;
	}

	public void setStartTime(Time startTime) {
		this.startTime = startTime;
	}

	public Timestamp getUpdatedAt() {
		return this.updatedAt;
	}

	public void setUpdatedAt(Timestamp updatedAt) {
		this.updatedAt = updatedAt;
	}
	
	public Set<Attendance> getAttendance() {
		return attendance;
	}

	public void setAttendance(Set<Attendance> attendance) {
		this.attendance = attendance;
	}

	public LearningPlace getLearningPlace() {
		return this.learningPlace;
	}

	public void setLearningPlace(LearningPlace learningPlace) {
		this.learningPlace = learningPlace;
	}

	public Class getClazz() {
		return clazz;
	}

	public void setClazz(Class clazz) {
		this.clazz = clazz;
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}

	public Faculty getFaculty() {
		return faculty;
	}

	public void setFaculty(Faculty faculty) {
		this.faculty = faculty;
	}
}